﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SilverTile.ExtensionMethods;
using System.Linq;

namespace SilverTile
{

    [Flags]
    public enum Collision : byte
    {
        None = 1,
        Top = 2,
        Right = 4,
        Bottom = 8,
        Left = 16,
        All = Top | Right | Bottom | Left
    }
    
    public static class CollsionExtensionMethods
    {

        private static Collision[] collisionTypes;

        public static bool IsSet(this Collision collision, Collision flags)
        {
            return (collision & flags) == flags;
        }

        public static bool IsNotSet(this Collision collision, Collision flags)
        {
            return !collision.IsSet(flags);
        }

        public static bool IsAnySet(this Collision collision, Collision flags)
        {
            return ((byte)(collision & flags)) > 0;
        }

        public static Collision Set(this Collision collision, Collision flags)
        {
            return collision | flags;
        }

        public static Collision Clear(this Collision collision, Collision flags)
        {
            return collision & (~flags);
        }

        public static bool Collides(this Collision collision)
        {
            return !collision.Equals(Collision.None);
        }

    }
}
